using Machine.Specifications;
using Unbound.Tests.Unbinding.Configuration;
using Unbound.Tests.Unbinding.TestObjects;

namespace Unbound.Tests.Unbinding.Specifications.SkippingProperties
{
	[Subject("Unbinding")]
	public class skipping_multiple_properties : unbinding<MoreComplexType>
	{
		Establish context = () =>
		                    	{
		                    		Request = new MoreComplexType
		                    		          	{
		                    		          		Number = 42,
		                    		          		Text = "Something",
		                    		          		Barf = new MoreComplexType.Bar {Digit = 2}
		                    		          	};
		                    		Prefix = "";
		                    		Unbind = () => Request.ToHttpDictionary(x => x.Barf, x => x.Text);
		                    	};

		It should_bind_the_included_property = () => ((MoreComplexType) Bound).Number.ShouldEqual(42);
		It should_not_bind_the_other_skipped_property = () => Unbound.Keys.ShouldNotContain("Barf");
		It should_not_bind_the_skipped_property = () => Unbound.Keys.ShouldNotContain("Text");
	}
}